<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\card\model;

class CardTags extends \app\BaseModel
{
    protected $name = "longbing_card_tags";
    protected static function init()
    {
    }
    public function cardTagList($staff_id, $client_id, $uniacid)
    {
        $data = self::where([["user_id", "=", $staff_id], ["uniacid", "=", $uniacid], ["status", "=", 1]])->select()->toArray();
        foreach ($data as $index => $item) {
            $data[$index]["thumbed"] = 0;
            $check = CardUserTags::where([["tag_id", "=", $item["id"]], ["user_id", "=", $client_id], ["uniacid", "=", $uniacid], ["status", "=", 1]])->count();
            if($check) {
                $data[$index]["thumbed"] = 1;
            }
        }
        return $data;
    }
    public function getTag($filter)
    {
        $result = $this->where($filter)->find();
        if(!empty($result)) {
            $result = $result->toArray();
        }
        return $result;
    }
    public function getTagCount($filter)
    {
        $count = $this->where($filter)->count();
        return $count;
    }
}

?>